from django.db import models

# Create your models here.

class TimeStampMixin(models.Model):
    created_at = models.DateTimeField(auto_now=True, help_text='添加时间',verbose_name='添加时间')
    updated_at = models.DateTimeField(auto_now_add=True, help_text='更新时间',verbose_name='更新时间')

from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
class Note(TimeStampMixin,models.Model):
    # id
    content = models.TextField(help_text='分享内容',verbose_name='分享内容')
    created_by = models.ForeignKey(get_user_model(),on_delete=models.CASCADE,help_text='必填', verbose_name='哪个用户添加的')

    class Meta:
        verbose_name = '分享表'
        verbose_name_plural =verbose_name
        db_table = 'notes'


class Imgs(models.Model):
    img = models.ImageField(verbose_name='图片',help_text='这是一样图片，必填',upload_to='upload/%Y/%m/%d')
